package org.ccsoft.minicontainer.samples.calculator;

import java.util.Set;

import org.ccsoft.mc.core.ServiceContext;
import org.ccsoft.mc.core.impl.MiniContainer;



/**
 * This client program shows how to create an SCA runtime, start it,
 * and locate and invoke a SCA component
 */
public class CalculatorClient {
    public static void main(String[] args) throws Exception {
    	MiniContainer container=new MiniContainer();
//    	String userDir = System.getProperty("user.dir") + "\\config\\calculator.xml";
    	
		container.loadBundlesFromClassPath("calculator.xml");
		ServiceContext context=container.getServiceContext();  
		Set<?> bundles=context.getUnResolvingServiceBundles();
		Set<?> bundles2=context.getReadyServiceBundles();//.getUnResolvingServiceBundles();
        CalculatorService calculatorService = (CalculatorService) context.getServiceByType(CalculatorService.class.getName());

        // Calculate
        System.out.println("3 + 2=" + calculatorService.add(3, 2));
        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
        System.out.println("3 / 2=" + calculatorService.divide(3, 2));

        
    }

}
